﻿
Partial Class Interfaz_ModuloPlanificacion_PopUpIngresoBT
    Inherits System.Web.UI.Page
    Dim CL As Logica.ModuloPlanificacion.ControladorLogica

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        CL = Logica.ModuloPlanificacion.ControladorLogica.getInstance

    End Sub
 

    Protected Sub BtnIngresarItemBiblioteca_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnIngresarItemBiblioteca.Click
        If validar() Then
            Dim it As Biblioteca_Tecnica = New Biblioteca_Tecnica(Me.TxtNombreBT.Text, Me.TxtPesoBT.Text, Me.TxtDescripcionBT.Text, Me.TxtTipoBT.Text, Me.TxtSuperficieBT.Text)
            CL.ingresarBibliotecaTecnica(it)
            Me.lblMensaje.ForeColor = Drawing.Color.Blue
            Me.lblMensaje.Text = ("Los Datos Han Sido Ingresados Exitosamente.")
            Me.limpiar()
            Response.Write(" <script type=""text/javascript"">window.opener.location.href = window.opener.location.href;</script>")
        Else
            Me.lblMensaje.ForeColor = Drawing.Color.Red
            Me.lblMensaje.Text = ("Favor Complete Todos Los Datos")
        End If
       
    End Sub

    Public Sub Mensaje(ByVal msg As String)
        Dim alertScript As String = "<script language=JavaScript runat=server>"
        alertScript &= "alert('" & msg & "');"
        alertScript &= "</script>"
        ClientScript.RegisterClientScriptBlock(Page.GetType(), "clientScrip", alertScript)
    End Sub

    Public Function validar() As Boolean
        If Me.TxtDescripcionBT.Text <> "" And Me.TxtNombreBT.Text <> "" And Me.TxtPesoBT.Text <> "" And Me.TxtSuperficieBT.Text <> "" And Me.TxtTipoBT.Text <> "" Then
            Return True
        End If
        Return False
    End Function

    Public Sub limpiar()
        Me.TxtDescripcionBT.Text = String.Empty
        Me.TxtNombreBT.Text = String.Empty
        Me.TxtPesoBT.Text = String.Empty
        Me.TxtSuperficieBT.Text = String.Empty
        Me.TxtTipoBT.Text = String.Empty
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Response.Write(" <script type=""text/javascript"">window.close(); </script>")
    End Sub


End Class
